<template>
  <h1>添加用户信息页面</h1>
  用户名：<input type="text" v-model="username" />
  <br />
  <input type="button" value="跳转至用户列表页面" @click="add" />
</template>

<script>
export default {
  data() {
    return {
      username: "",
    };
  },
  methods: {
    add() {
      if (this.username.trim()) {
        this.$router.push({
          path: "/show",
          query: { username: this.username },
        });
      }
    },
  },
};
</script>

<style>
</style>